#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char *argv[]){
    char buf[32] = {0};
    mkfifo("test", 0666);
    int fd1 = open("test", O_RDWR);
    int fd = open(argv[1], O_RDONLY);
    while(1){
        read(fd, buf, sizeof(buf));
        write(fd1, buf, strlen(buf) + 1);
        if(buf[0] == '\0'){
            break;
        }
    }
    close(fd);
    close(fd1);
    return 0;
}